<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>list.js</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        
        <h1>
            list.js
        </h1>
        <ul class="files">
            
            <li>
                lib/assets/javascripts/ruiqu_app/todos/list.js
                
            </li>
            <li>Last modified: 2017-01-04 10:35:26 +0800</li>
        </ul>
    </div>

    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<p>jQuery(function($){</p>

<pre><code>$(&quot;button.js-todo-finish-list&quot;).on(&quot;click&quot;, function(){
  var finishedList = JST[&#39;ruiqu/todos/finished_list&#39;]
  $.ajax({
    url: &quot;/api/todos/finished&quot;,
    method: &quot;get&quot;,
    success: function(data){
      $(&quot;ul#todo-list form&quot;).html(finishedList(data))
      getTodoCheckedLength();
    }
  })
}); //end finished list todo

$(&quot;button.js-todo-unfinish-list&quot;).on(&quot;click&quot;, function(){
  var unfinishedList = JST[&#39;ruiqu/todos/unfinished_list&#39;]
  $.ajax({
    url: &quot;/api/todos&quot;,
    method: &quot;get&quot;,
    success: function(data){
      $(&quot;ul#todo-list form&quot;).html(unfinishedList(data))
      getTodoCheckedLength()
    }
  })
}); //end unfinished list todo

$(&quot;button.js-todo-all-list&quot;).on(&quot;click&quot;, function(){
  var list = JST[&#39;ruiqu/todos/list&#39;]
  $.ajax({
    url: &quot;/api/todos/list&quot;,
    method: &quot;get&quot;,
    success: function(data){
      $(&quot;ul#todo-list form&quot;).html(list(data))
      getTodoCheckedLength()
    }
  })
}); //end all list todo

$(&quot;div#todo-app a.js-clear-todo&quot;).on(&quot;click&quot;, function(){
  BootstrapDialog.confirm(&#39;确定删除这些任务吗？&#39;, function(result){
    if(result){
      var formdata = $(&quot;ul#todo-list form&quot;).serializeJSON();
      var csrf = $(&quot;input#js-todo-index-csrf&quot;).val();
      var ids = formdata.ids
      $.ajax({
        url: &quot;/api/todos/delete&quot;,
        method: &#39;delete&#39;,
        headers: {
                              &#39;X-CSRF-Token&#39;: csrf
                      },
        data: {ids: ids},
        success: function(data){
          if(data.status == true){
            ids.forEach(function(item){
              $(&quot;li#js-todo-li-&quot;+ item).remove();
              $(&quot;a.js-clear-todo&quot;).hide();
            })
          }
        }
      })
    }
  })
}) // end delete some checked todo</code></pre>

<p>});</p>

    </div>
  


  


  
  


  


  

  



  

    

    

    


    


    <!-- Methods -->
              </div>

    </div>
  </body>
</html>
